<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            color:yellow;
        }
    </style>

    <script src="./react/react.development.js"></script>
    <script src="./react/react-dom.development.js"></script>
    <script src="./react/babel.min.js"></script>
</head>
<body>
<div id="app"></div>
<script type="text/babel">

    //JSX=JS+xml、


    let app = document.querySelector('#app');
    let root = ReactDOM.createRoot(app);

    //挂载节点,浏览器不认识，需要用babel转换
    let element = <h2 title='hi'>hello world</h2>;

    //模板语法
    //添加注释
    //属性渲染变量
    //事件渲染函数
    //style渲染对象
    //{}渲染jsx

    let myClass = 'box'

    let handleClick = () => {
        console.log(123)
    }

    let myStyle = {
        color:'red'
    }
    element = (
        <div>
            {/*<p>{1+1}</p>*/}
            <p className={myClass}>{'hello'}</p>
            <p onClick={handleClick}>{'hello'.repeat(3)}</p>
            <p style={myStyle}>{true?123:456}</p>
            <p>{<h2>span111</h2>}</p>
        </div>
    );

    root.render(element);

</script>
</body>
</html>